﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EBookStore.Payments
{
    /// <summary>
    /// Accepted credit cards.
    /// </summary>
    public enum eCreditCard : short
    {
        Visa = 1,
        AmericanExpress = 2,
        MasterCard = 3
    }

    public abstract class Payment
    {


        protected string _id;
        /// <summary>
        /// Payment Transcation ID
        /// </summary>
        public string ID { get { return _id; } }

        /// <summary>
        /// Total payment sum
        /// </summary>
        public decimal Sum { get; set; }


        string _orderID;
        /// <summary>
        /// OrderID reference
        /// </summary>
        public string OrderID { get { return _orderID; } }

        /// <summary>
        /// Number of payments
        /// </summary>
        public int Payments { get; set; }

        /// <summary>
        /// Sum of first payment.
        /// </summary>
        public decimal FirstPayment { get; set; }

        /// <summary>
        /// If Payments more then 1 --> this value is "counted"
        /// </summary>
        public decimal OtherPayments { get; set; }

        /// <summary>
        /// Base constructor.
        /// </summary>
        public Payment()
        {
            _id = Utils.IDGenerator.CreateUniqeID();
            Payments = 0;
            _orderID = string.Empty;
            Sum = FirstPayment = OtherPayments = 0;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="p"></param>
        public Payment(Payment p)
        {
            this._id = p.ID;
            this.Sum = p.Sum;
            this._orderID = p.OrderID;
            this.Payments = p.Payments;
            this.FirstPayment = p.FirstPayment;
            this.OtherPayments = p.OtherPayments;

        }



        /// <summary>
        /// Charge client
        /// </summary>
        /// <returns></returns>
        public abstract bool Charge();

        /// <summary>
        /// Refund for client.
        /// </summary>
        /// <returns></returns>
        public abstract bool Refund();
    }


   


   
}
